
function startEditTask(id,team,start,end,tsk) {
	var forma = document.getElementById("task_form");
	forma.id.value=id;
	forma.op.value='edit';
	forma.teamid.value=team;
	forma.task.value=tsk;
	forma.startdate.value = start;
	forma.enddate.value = end;
	document.getElementById("task_edit_form").style.display = '';
	document.getElementById("task_add_form").style.display = 'none';
}

function cancelEditTask() {
	var forma = document.getElementById("task_form");
	forma.op.value='add';
	forma.id.value='';
	forma.teamid.value='0';
	forma.task.value='';
	forma.startdate.value='';
	forma.enddate.value='';
	document.getElementById("task_edit_form").style.display = 'none';
	document.getElementById("task_add_form").style.display = '';
}

function validateTask(form) {
	var forma = document.getElementById(form);
	var valid=true;

	var el = getDateFromString(forma.startdate.value,longDateFormat);
	var desde=new Date();
	desde.setFullYear(el.year,el.month,el.day);

	el = getDateFromString(forma.enddate.value,longDateFormat);
	var hasta=new Date();
	hasta.setFullYear(el.year,el.month,el.day);

	if (hasta<desde) {
		valid=false;
		alert(invalidDateMessage);
	} else if (forma.task.value=='') {
		valid=false;
		alert(messageMissingMessage);
	}
	if (valid) doProcess(form);

}

function deleteTask() {
	if (deleteconfirm) { 
		updateRequest('','remove',"task_list_form");
	}	
}